import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.12
import "./qml"
import "./qml/ConfigManager"

ApplicationWindow {
    visible: true
    width: 1200
    height: 800
    title: qsTr("Silicool Vision")

    SilicolMsgBox{
        id: silicolMsgBox
    }

    Connections{
        target: msgBoxModel
        onMsgBoxCountChanged:{
            if(count > 0)
            {
                silicolMsgBox.msgBoxCount = count
                silicolMsgBox.open()
            }
            else{
                silicolMsgBox.close()
            }
        }
    }

    SwipeView {
        id: swipeView
        anchors.fill: parent
        currentIndex: tabBar.currentIndex

        Page1Form {
        }

        Page2Form {
        }

        Page{
            ScrollView{
                anchors.fill: parent
                clip: true

                RowLayout{
                    ObjectEditor{
                        sectionName: "cameraConfig"
                        configModel: cameraConfig
                        listMaxWidth: 600
                        Component.onCompleted: {
                            init()
                        }
                    }

                    ObjectEditor{
                        sectionName: "prConfig"
                        configModel: prConfig
                        listMaxWidth: 600
                        Component.onCompleted: {
                            init()
                        }
                    }
                }
            }
        }
    }

    footer: TabBar {
        id: tabBar
        currentIndex: swipeView.currentIndex

        TabButton {
            text: qsTr("Live View")
        }
        TabButton {
            text: qsTr("PR View")
        }
    }
}
